{% extends "admin/base_site.html" %}

<!-- LOADING -->
{% load i18n adminmedia fb_tags %}

<!-- STYLESHEETS -->
{% block extrastyle %}
    {{ block.super }}
    <link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />
    <link rel="stylesheet" type="text/css" href="{{ settings_var.URL_FILEBROWSER_MEDIA }}css/filebrowser.css" />
    <link rel="stylesheet" type="text/css" href="{{ settings_var.URL_FILEBROWSER_MEDIA }}uploadify/uploadify.css" />
{% endblock %}

<!-- JAVASCRIPTS -->
{% block extrahead %}
    {{ block.super }}
    <script type="text/javascript" src="{% admin_media_prefix %}js/core.js"></script>

{% endblock %}

<!-- COLTYPE/BODYCLASS -->
{% block coltype %}colM{% endblock %}
{% block bodyclass %}change-form filebrowser{% if query.pop %} popup{% endif %}{% endblock %}

<!-- BREADCRUMBS -->
{% block breadcrumbs %}
    {% with "filebrowser/"|add:settings_var.SKIN|add:"/include/breadcrumbs.html" as breadcrumbs_template %}
        {% include  breadcrumbs_template %}
    {% endwith %}
{% endblock %}

<!-- CONTENT -->
{% block content %}
<div id="content-main">
    <form id="images-form"
              action="."
              method="post"
              enctype="multipart/form-data">
    <div class="fieldset flash" id="fsUploadProgress"></div>
            <div id="divStatus"></div>
            <div>
                <span id="spanButtonPlaceHolder"></span>
                <input id="btnUpload"
                       type="button"
                       value='{% trans "Select Images" %}'
                       style="width: 100px; height: 22px; font-size: 8pt;" />

                <input id="btnCancel"
                       type="button"
                       value="Cancel All Uploads"
                       onclick="swfu.cancelQueue();"
                       disabled="disabled"
                       style="margin-left: 2px; font-size: 8pt; height: 29px;" />
            </div>
    </form>
<script type="text/javascript" src="{{ settings_var.URL_FILEBROWSER_MEDIA }}swfupload/swfupload.js"></script>
    <script type="text/javascript" src="{{ settings_var.URL_FILEBROWSER_MEDIA }}swfupload/swfupload.queue.js"></script>
    <script type="text/javascript" src="{{ settings_var.URL_FILEBROWSER_MEDIA }}swfupload/fileprogress.js"></script>
    <script type="text/javascript" src="{{ settings_var.URL_FILEBROWSER_MEDIA }}swfupload/handlers.js"></script>
    <script type="text/javascript" src="{{ settings_var.URL_FILEBROWSER_MEDIA }}swfupload/swfupload.cookies.js"></script>
    <script type="text/javascript" src="{% admin_media_prefix %}js/admin/CollapsedFieldsets.js"></script>
    <script type="text/javascript">
        var swfu;

        var settings = {
            flash_url : "{{ settings_var.URL_FILEBROWSER_MEDIA }}swfupload/swfupload.swf",
            upload_url: "{% url fb_do_upload %}",
            post_params: {'session_key': '{{session_key}}'},
            file_size_limit : "100 MB",
            file_types : "*.*",
            file_types_description : "All Files",
            file_upload_limit : {{ settings_var.MAX_UPLOAD_SIZE }},
            file_queue_limit : 0,
            custom_settings : {
                progressTarget : "fsUploadProgress",
                cancelButtonId : "btnCancel"
            },
            debug: true,

            // Button settings
            button_width: "100",
            button_height: "45",
            button_placeholder_id: "spanButtonPlaceHolder",
            button_text_left_padding: 0,
            button_text_top_padding: 13,
            button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
            button_cursor : SWFUpload.CURSOR.HAND,
            button_image_url: "images/TestImageNoText_65x29.png",
            button_text: '<span class="theFont">Hello</span>',
            button_text_style: ".theFont { font-size: 16; }",


            // The event handler functions are defined in handlers.js
            file_queued_handler : fileQueued,
            file_queue_error_handler : fileQueueError,
            file_dialog_complete_handler : fileDialogComplete,
            upload_start_handler : uploadStart,
            upload_progress_handler : uploadProgress,
            upload_error_handler : uploadError,
            upload_success_handler : uploadSuccess,
            upload_complete_handler : uploadComplete,
            queue_complete_handler : queueComplete  // Queue plugin event
        };

        swfu = new SWFUpload(settings);
    </script>
</div>
{% endblock %}
